package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-08-13
 * Time: 21:05
 */

class myRunnable implements Runnable {
    @Override
    public void run() {

        while (true) {
            System.out.println("hello world");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Demo2 {
    public static void main(String[] args) throws InterruptedException {
        myRunnable myRunnable = new myRunnable();
        Thread i = new Thread(myRunnable);

        i.start();

        while (true) {
            System.out.println("hello main");
            Thread.sleep(1000);
        }
    }
}
